from typing import List


class Solution:
    def binarySearch(self, list, targt, start, end):
        if len(list)==0:
            return False
        if start == end:
            return list[start] == targt
        if targt < list[start] or targt > list[end]:
            return False

        mid = int(start + (end - start) / 2)
        if list[mid] == targt:
            return True
        if list[mid] < targt:
            return self.binarySearch(list, targt, mid + 1, end)
        if list[mid] > targt:
            return self.binarySearch(list, targt, start, mid - 1)

    def findNumberIn2DArray(self, matrix: List[List[int]], target: int) -> bool:
        if len(matrix) == 0:
            return False
        for i in range(len(matrix)):
            if self.binarySearch(matrix[i], target, 0, len(matrix[0]) - 1):
                return True
        return False


if __name__ == '__main__':
    list1 = [
        []
    ]
    #
    # s = Solution()
    # s.findNumberIn2DArray(list1,20)
    s = Solution()
    print(s.binarySearch(list1[0], 11, 0, 4))
    print(list1)

